package com.weilele.leisure.time.ui.holder

import android.view.View
import android.widget.CompoundButton
import com.weilele.leisure.time.databinding.HolderSettingSwitchItemBinding
import com.weilele.mvvm.adapter.MvvmHolder


class SettingSwitchItemHolder :
    MvvmHolder<SettingSwitchItemHolder.Bean, HolderSettingSwitchItemBinding> {
    constructor(binding: HolderSettingSwitchItemBinding) : super(binding)
    constructor(itemView: View) : super(itemView)

    data class Bean(
        var text: String,
        var isCheck: Boolean,
        val onCheckChange: CompoundButton.OnCheckedChangeListener
    )

    override fun bindData(data: Bean) {
        mBinding.switchView.isChecked=data.isCheck
        mBinding.switchView.text = data.text
        mBinding.switchView.setOnCheckedChangeListener(data.onCheckChange)
    }

}